﻿#include <iostream>
#include <stdio.h>
#include <string.h>
#include <assert.h>
using namespace std;
namespace Ysz

{
	
	class string

	{

		friend ostream& operator<<(ostream& _cout, const Ysz::string& s);
		friend istream& getline(istream& in, string& s, char delim );
		friend istream& operator>>(istream& _cin, Ysz::string& s);

	public:

		typedef char* iterator;

	public:

		string(const char* str = "");

		string(const string& s);

		string& operator=(const string& s);

		~string();





		iterator begin();

		iterator end();



	

		void push_back(char c);

		string& operator+=(char c);

		void append(const char* str);

		string& operator+=(const char* str);

		void clear();

		void swap(string& s);

		const char* c_str()const;



		

		size_t size()const;

		size_t capacity()const;

		bool empty()const;

		void resize(size_t n, char c = ' ');

		void reserve(size_t n);





		char& operator[](size_t index);

		const char& operator[](size_t index)const;




		bool operator<(const string& s);

		bool operator<=(const string& s);

		bool operator>(const string& s);

		bool operator>=(const string& s);

		bool operator==(const string& s);

		bool operator!=(const string& s);



	

		size_t find(char c, size_t pos = 0) const;


		size_t find(const char* s, size_t pos = 0) const;

	
		string& insert(size_t pos, char c);

		string& insert(size_t pos, const char* str);
		string substr(size_t pos, size_t len = npos);



		string& erase(size_t pos, size_t len= npos);

	private:

		char* _str;

		size_t _capacity;

		size_t _size;
		const static size_t npos;
	};
	ostream& operator<<(ostream& _cout, const string& s);
	istream& operator>>(istream& _cin, string& s);
	istream& getline(istream& in, string& s, char delim = '\n');
};
